import allure
from common.page import Page
from regression_service.funtion.fun_main import Main
from regression_service.page_elements.el_login import login


class Login:
    @allure.step('step:输入账号')
    def sendkeys_usename(self,data):
        Page.send_key(login,'登录','账号',data)
        return Login()

    @allure.step('step:输入密码')
    def sendkeys_password(self,data):
        Page.send_key(login,'登录','密码',data)
        return Login()

    @allure.step('step:点击登录')
    def click_login(self):
        Page.click(login,'登录','授权并登录')
        return Main()

    def login(self, usename, password):
        self.sendkeys_usename(usename)
        self.sendkeys_password(password)
        self.click_login()
        return Main()